<?php
namespace app\admin\controller;
use app\admin\controller\Common;
/*
 * -- ----------------------------
 * --  首页
 * -- ----------------------------
 */
class Index extends Common{
  public function index(){
    $time = db('click')->where('update_time','> time','today')->max('update_time');
    if(!$time){
      db('click')->where('id',3)->update(['click'=>0]);

      $num = implode(db('click')->where('id',4)->field('click')->find())*1;
      db('visitor')->where('id','>',0)->delete();
      db('click')->where('id',2)->update(['tory'=>$num,'click'=>$num]);
      db('click')->where('id',4)->update(['click'=>0]);
    }
    $click = db('click')->select();
    $this->assign('click',$click);
    return view();
  }

}
?>